//---------------------------------------------------------------------------
#ifndef uCalcExcelH
#define uCalcExcelH
//---------------------------------------------------------------------------
#include "uCalcCommon.h"
//---------------------------------------------------------------------------
class CExcelColumn : public CCalcColumn
{
  private:
    int  __fastcall GetWidth( void);
    void __fastcall SetWidth( int nWidth);

  public:
    __fastcall CExcelColumn( Variant vColumn);
};
//---------------------------------------------------------------------------
class CExcelColumns : public CCalcColumns
{
  private:
    CExcelColumn *m_Column;

    int          __fastcall GetCount( void);
    CCalcColumn *__fastcall GetItem( int c);

  public:
            __fastcall  CExcelColumns( Variant vColumns);
    virtual __fastcall ~CExcelColumns( void);
};
//---------------------------------------------------------------------------
class CExcelStyle : virtual public CCalcStyle
{
  private:
    long        __fastcall GetBackgroundColor( void);
    void        __fastcall SetBackgroundColor( long lColor);
    CBorders    __fastcall GetBorders( void);
    void        __fastcall SetBorders( const CBorders &eBorders);
    CTextAlign  __fastcall GetTextAlign( void);
    void        __fastcall SetTextAlign( const CTextAlign &eAlign);
    TFontStyles __fastcall GetFontStyle( void);
    void        __fastcall SetFontStyle( const TFontStyles &eStyle);
    bool        __fastcall GetLocked( void);
    void        __fastcall SetLocked( bool bLocked);

  public:
    __fastcall CExcelStyle( void) : CCalcStyle() {};
};
//---------------------------------------------------------------------------
class CExcelCell : public CCalcCell, public CExcelStyle
{
  private:
    AnsiString __fastcall GetText( void);
    void       __fastcall SetText( const AnsiString &strText);
    Currency   __fastcall GetMoney( void);
    void       __fastcall SetMoney( const Currency &curValue);
    TDateTime  __fastcall GetDate( void);
    void       __fastcall SetDate( const TDateTime &dtValue);

  public:
    __fastcall CExcelCell( Variant vCell);
};
//---------------------------------------------------------------------------
class CExcelCells : public CCalcCells
{
  private:
    CExcelCell *m_Cell;

    CCalcCell *__fastcall GetItem( int x, int y);

  public:
           __fastcall  CExcelCells( Variant vCells);
   virtual __fastcall ~CExcelCells( void);
};
//---------------------------------------------------------------------------
class CExcelRange : public CCalcRange, public CExcelStyle
{
  public:
    __fastcall CExcelRange( Variant vRange);
};
//---------------------------------------------------------------------------
class CExcelWorksheet : public CCalcWorksheet
{
  private:
    CExcelCells   *m_Cells;
    CExcelRange   *m_Range;
    CExcelColumns *m_Columns;

    CCalcCells   *__fastcall GetCells( void);
    CCalcColumns *__fastcall GetColumns( void);
    AnsiString    __fastcall GetName( void);
    void          __fastcall SetName( const AnsiString &strName);

  public:
            __fastcall  CExcelWorksheet( Variant vWorksheet);
    virtual __fastcall ~CExcelWorksheet( void);

    CCalcRange *__fastcall GetRange( int x1, int y1, int x2, int y2);
    void        __fastcall Protect( const AnsiString &strPassword);
};
//---------------------------------------------------------------------------
class CExcelWorksheets : public CCalcWorksheets
{
  private:
    CExcelWorksheet *m_Worksheet;

    CCalcWorksheet *__fastcall GetItem( int nIndex);
    int             __fastcall GetCount( void);

  public:
            __fastcall  CExcelWorksheets( Variant vWorksheets);
    virtual __fastcall ~CExcelWorksheets( void);

    void __fastcall Add( void);
};
//---------------------------------------------------------------------------
class CExcelWorkbook : public CCalcWorkbook
{
  private:
    Variant           m_vWorkbooks;
    CExcelWorksheets *m_Worksheets;

    CCalcWorksheets *__fastcall GetWorksheets( void);

  public :
            __fastcall  CExcelWorkbook( Variant vWorkbook);
    virtual __fastcall ~CExcelWorkbook( void);

    void __fastcall Create( void);
    void __fastcall Open  ( const AnsiString &strFilename);
    void __fastcall SaveAs( const AnsiString &strFilename);
};
//---------------------------------------------------------------------------
class PACKAGE_OUTILS CExcel : public CCalc
{
  private:
    CExcelWorkbook *m_Workbook;

    bool           __fastcall GetVisible( void);
    void           __fastcall SetVisible( bool bVisible);

    CCalcWorkbook *__fastcall GetWorkbook( void);

  public:
         __fastcall  CExcel( void);

    void __fastcall Init( void);
    void __fastcall Terminate( void);
};
//---------------------------------------------------------------------------
#endif
